
package html;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import common.UserBean;

/**
 * url: http://127.0.0.1:8080/ExcelExport/html/htmlExport<br>
 * <br>
 * 只將 jsp 的 contentType 設定為 "application/vnd.ms-excel"<br>
 * 就可以開啟 excel 或者存檔(.xls)
 * 
 * @author Grady.Kao
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2000-2008
 */

public class HtmlExportServlet extends HttpServlet
{
	private static final long serialVersionUID = -1252714487037679875L;

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
	{
		UserBean bean = new UserBean();
		bean.setName( "Grady.Kao" );
		bean.setPassword( "1234" );

		request.setAttribute( "Bean", bean );

		request.getRequestDispatcher( "/html/htmlInfo.jsp" ).forward( request, response );
	}
}
